﻿using Orchard.ContentManagement.Drivers;
using PmpNetwork.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PmpNetwork.Drivers
{
    public class WikiArticlePartDriver : ContentPartDriver<WikiArticlePart>
    {
        protected override DriverResult Display(WikiArticlePart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_WikiArticle", () => shapeHelper.Parts_WikiArticle(
                    Part: part
                ));//shapeHelper.Parts_WikiArticle(Part: part);
        }
        protected override DriverResult Editor(WikiArticlePart part, dynamic shapeHelper)
        {
            return ContentShape("Parts_WikiArticle_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts/WikiArticle", Model: part, Prefix: Prefix));
        }
        protected override DriverResult Editor(WikiArticlePart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper)
        {
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);
        }
    }
}